Specifying Which Messages Your Driver Overrides
You must include an override ('over'
) resource in your printer driver to provide QuickDraw GX with a list of the printing messages that your driver is overriding.
Each entry in the override resource specifies a message and information about the resource in which the code segment for the message override is found. You need to include separate override resources for universal messages and for messages specific
to an imaging system. The override resource is described on page 6-13 in the chapter "Printing Resources."The code segment information for each message includes the resource ID of the code segment and the offset into the code segment that contains the instruction to jump to the message-override function. The first 4 bytes of the code segment are reserved for use by QuickDraw GX and must be 0; thus, the first offset location is 4.
Each override resource in a printer driver has an ID of
gxPrintingDriverBaseID
for universal messages, an ID ofgxPrintingDriverBaseID+1
for messages specific to an imaging system, and an ID ofgxPrintingDriverBaseID+2
for Macintosh Printing Manager compatibility messages, as shown in Listing 3-20.Listing 3-20 Override resources for the ImageWriter II printer driver
#define firstOffset 4 #define segmentID NewSegID resource gxOverrideType (gxPrintingDriverBaseID+0, sysHeap, purgeable) { { gxInitialize, segmentID, firstOffset + 0, gxShutDown, segmentID, firstOffset + 4, gxDefaultPrinter, segmentID, firstOffset + 8, gxDefaultFormat, segmentID, firstOffset + 12, gxDefaultJob, segmentID, firstOffset + 16, gxJobDefaultFormatDialog, segmentID, firstOffset + 20, gxJobFormatModeQuery, segmentID, firstOffset + 24, gxRenderPage, segmentID, firstOffset + 28, gxOpenConnection, segmentID, firstOffset + 32, gxCloseConnection, segmentID, firstOffset + 36, gxStartSendPage, segmentID, firstOffset + 40, gxSetupImageData, segmentID, firstOffset + 44, }; }; resource gxOverrideType (gxPrintingDriverBaseID + 1, sysHeap, purgeable) { { gxRasterPackageBitmap,segmentID, firstOffset + 48, gxRasterLineFeed, segmentID, firstOffset + 52, }; }; #define segmentID OldSegID resource gxOverrideType (gxPrintingDriverBaseID + 2, sysHeap, purgeable) { { gxConvertPrintRecordTo, segmentID, firstOffset + 0, gxConvertPrintRecordFrom,segmentID, firstOffset + 4, gxPrintRecordToJob, segmentID, firstOffset + 8, gxPrValidate, segmentID, firstOffset + 12, gxPrJobInit, segmentID, firstOffset + 16, }; };Each resource in Listing 3-20 lists the messages that the ImageWriter II driver overrides. The first resource lists the universal messages, the second resource lists the messages specific to the raster imaging system, and the third resource lists the Macintosh Printing Manager compatibility messages. The code for the compatibility message overrides is located in a different code segment.Each message listed in the resources specifies the name of the message, the ID of that segment, and where to find the message in the jump table. The ID of the code segment for all of these messages is defined by the constant
segmentID
. The jump instructions to the code that implements the overrides are each 4 bytes long. The first jump is found at the first offset location (byte 4), and each subsequent jump is found 4 bytes beyond the previous one.
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help